﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" MasterPageFile="~/Site.master" Inherits="Team4.rooms.Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <table>
        <tr>
            <td>
                <fieldset>
                    <legend>Edit/Delete Rooms</legend>
                    <asp:GridView ID="RoomGridView" runat="server" AutoGenerateColumns="False" DataKeyNames="Id,Name,Number"
                        DataSourceID="RoomObjectDataSource">
                        <Columns>
                            <asp:TemplateField ShowHeader="False">
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True"  CssClass="myButton"
                                        CommandName="Update" Text="Update"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"  CssClass="myButton"
                                        CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"  CssClass="myButton"
                                        CommandName="Edit" Text="Edit"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"  CssClass="myButton"
                                        CommandName="Delete" Text="Delete" OnClientClick='return confirm("Are you sure you want to delete this room?");'></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="TextField" HeaderText="TextField" ReadOnly="True" 
                                SortExpression="TextField" Visible="False" />
                            <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                                SortExpression="Id" />
                            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                            <asp:BoundField DataField="Number" HeaderText="Number" 
                                SortExpression="Number" />
                        </Columns>
                    </asp:GridView>
                    <asp:ObjectDataSource ID="RoomObjectDataSource" runat="server" 
                        DataObjectTypeName="Team4.BLL+Room" DeleteMethod="DeleteRoom" 
                        InsertMethod="CreateRoom" SelectMethod="GetAllRooms" TypeName="Team4.BLL+Room" 
                        UpdateMethod="UpdateRoom"></asp:ObjectDataSource>
                </fieldset>
            </td>
        </tr>
        <tr>
            <td>
                <fieldset>
                    <legend>New Room</legend>
                    <table>
                        <tr>
                            <th></th>
                            <th>Name</th>
                            <th>Number</th>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="addRoomButton" runat="server" Text="Add" OnClick="addRoomButton_OnClick" CssClass="myButton" />
                            </td>
                            <td>
                                <asp:TextBox ID="roomNameTextBox" runat="server" ></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="roomNumberTextBox" runat="server" ></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </td>
        </tr>
    </table>
</asp:Content>